#include <iostream>
#include <string>
#include <jsoncpp/json/json.h>

int main()
{
    Json::Value root;
    root["name"] = "hdp";
    root["sex"] = "男";
    root["age"] = "21";

    // Json::Value ss;
    // ss["tel"] = "22222";
    // ss["籍贯"] = "汉族";

    // root["info"] = ss;

    // std::string s = root.toStyledString();
    // std::cout << s << std::endl;
    //Json::FastWriter writer;//去掉\n，网络传送数据量小，所以传送速度相对来说较快
    Json::StyledWriter writer;//用\n按行设置,可读性好
    std::string s = writer.write(root);

    std::cout<< s << std::endl;
    return 0;
}